import React, { Component } from 'react'

export default class ComSon extends Component {
    constructor() {
        super();
        this.state = {
            msg: '同学们，好好听课'
        }
    }
    render() {
        return (
            <div>
                {/* 单向数据流，父组件传来的值是read only property，只读属性不能修改 */}
                子组件---父组件传来的值：  {this.props.age}
                <button onClick={()=>this.props.post(this.state.msg)}>子传父</button>
            </div>
        )
    }
}
